package router

// 路由路径配置

import (
	"mygindemo/db"
	"mygindemo/util"
	"net/http"

	"github.com/ahviplc/GoJustToolc/UUtils/UDateTimeUtil"
	"github.com/ahviplc/GoJustToolc/UUtils/UMd5Util"
	"github.com/gin-gonic/gin"
)

// root Json拼接
func Root(c *gin.Context) {
	c.JSON(http.StatusOK, gin.H{
		"message":               "I am root",
		"projectName":           "mygindemo",
		"author":                util.AUTHORS,
		"version":               util.VERSION,
		"UseGoJustToolcGetGuid": UMd5Util.GetGuid(),
		"GoJustToolcUrl":        "https://github.com/ahviplc/GoJustToolc",
		"NowDateTime":           UDateTimeUtil.NowDateTime(),
	})
}

// hello1 test
func Hello1(c *gin.Context) {
	c.JSON(http.StatusOK, gin.H{
		"message": "hello world 1",
	})
}

// hello2 test
func Hello2(c *gin.Context) {
	c.JSON(http.StatusOK, gin.H{
		"message": "hello world 2",
	})
}

// 查询所有的User
func FindAllUsers(c *gin.Context) {
	c.JSON(http.StatusOK, db.FindAllUsersDB())
}

// 根据主键查询第一个User
func FindFirstOneUser(c *gin.Context) {
	c.JSON(http.StatusOK, db.FindFirstOneUserDB())
}

// 。。。未完待续
